<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://www.springframework.org/tags" prefix="spring"%>

<c:forEach items="${productGroup}" var="pG">
	<div class="box m">
		<div style="color: #ee344b; text-transform: uppercase" class="btitle">
			<c:out value='${pG.name}' />
		</div>
		<div class="bCt productLs">
			<c:forEach items="${productListMap[pG.id]}" var="p">
				<div class="it">
					<a title="<c:out value='${p.name}'/>"
						href="viewProduct.html?pId=${p.id}"> <span class="t"><c:out
								value='${p.name}' /></span> <c:if test="${not empty p.productImages}">
							<img style="max-width: 120px; max-height: 100px;" alt="${p.name}"
								src="<c:url value="loadImage.html?type=THUMB&fileId=${p.productImages[0]}"/>"
								border="0">
						</c:if>
					</a>
					<div class="pr">${p.getUnitPriceAsSale()}</div>
					<p>
						<c:out value='${p.highlight}' />
					</p>
					<div class="btn buy">
						<a title="<spring:message code="cart.buy" />" href="javascript:addToCart(${p.id},'${p.name }',${p.productImages},${p.unitPrice});"><spring:message
								code="cart.buy" /></a>
					</div>
				</div>
			</c:forEach>
			<c:if test="${empty productListMap[pG.id]}">
				<spring:message code="product.no.available" />
			</c:if>
			<div class="clear"></div>
			<c:if test="${not empty productListMap[pG.id]}">
				<c:if test="${productListMap[pG.id][0].totalPage > 1}">
					<div style="text-align: center;" class="pages">
						<div style="display: inline-block;">
							<spring:message code="page.pagination.title" />
							<c:forEach begin="1" end="${productListMap[pG.id][0].totalPage}" step="1"
								var="page">
								<c:if test="${page == param.page }">
									<span class="current">${page}</span>&nbsp;|
							</c:if>

								<c:if test="${!(page == param.page)}">
									<span><a
										href="searchProduct.html?page=${page}&productGroupId=${pG.id}">${page}</a></span>&nbsp;|
							</c:if>
							</c:forEach>
						</div>
					</div>
				</c:if>
			</c:if>
		</div>
	</div>
</c:forEach>